﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Profile;
using PBDesk.Utilities;
using System.Web.Security;

namespace CMS.PBDesk.Framework.Web
{
    public class ProfileHelper
    {
        private System.Web.Profile.ProfileBase m_profileBase;


        #region Profile Properties
        
        #endregion GetProfile() Methods

        public static MemberProfile GetProfile()
        {
            return GetProfile(true);
        }
        public static MemberProfile GetProfile(bool isAuthenticated)
        {
            MemberProfile profile = null;
            MembershipUser user = Membership.GetUser();
            if (user != null)
            {
                if (CommonHelper.IsValidUserName(user.UserName))
                    profile = GetProfile(user.UserName, isAuthenticated);
            }
            return profile;
        }

        public static MemberProfile GetProfile(string userName, bool isAuthenticated)
        {
            MemberProfile profile = null;
            if (CommonHelper.IsValidUserName(userName))
            {
                profile = ProfileBase.Create(userName, isAuthenticated) as MemberProfile;
            }
            return profile;
        }

        #region


        #endregion
    }

    
}
